TensorFlow 安装及使用

您所在的位置:网站首页 msbuild1 outputs warning TensorFlow 安装及使用

TensorFlow 安装及使用

#TensorFlow 安装及使用| 来源: 网络整理| 查看: 265

安装

(1)安装包安装:pip install tensorflow==1.14 -i https://pypi.douban.com/simple

virtualenv -p /usr/bin/python2.7 venv-python2.7-tf1.14.0source ./venv-python2.7-tf1.14.0/bin/activatepip listpythonpip install numpy==1.16.5 opt-einsum==2.3.2 future -i https://pypi.douban.com/simplepip install tensorflow==1.14.0 -i https://pypi.douban.com/simple

(2)源码编译安装:https://tensorflow.google.cn/install/source

Install bazel-0.25.2# wget https://github.com/bazelbuild/bazel/releases/download/0.25.2/bazel-0.25.2-linux-x86_64# chmod u+x bazel-0.25.2-linux-x86_64# ln -s /path/bazel-0.25.2-linux-x86_64 /usr/bin/bazel# bazel versionBuild label: 0.25.2Install tensorflow-1.14.0# git clone https://github.com/tensorflow/tensorflow.git# cd tensorflow# git checkout v1.14.0# ./configure   # /usr/bin/python3, others are default# bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package# ./bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg# mv /tmp/tensorflow_pkg/tensorflow-1.14.0-cp36-cp36m-linux_x86_64.whl ./# python3 -m pip install ./tensorflow-1.14.0-cp36-cp36m-linux_x86_64.whlinstall tensorflow-1.14.0 with MKL&Patch# git clone https://github.com/tensorflow/tensorflow.git# cd tensorflow/# git checkout v1.14.0# patch -p0 &1 &

可视化工具 TensorBoard 用法: https://blog.csdn.net/gg_18826075157/article/details/78440766

(5)量化、固化、优化 pb 模型 官方手册:https://github.com/tensorflow/tensorflow/tree/master/tensorflow/tools/graph_transforms intel 量化手册:https://github.com/IntelAI/tools/tree/master/tensorflow_quantization

# bazel build tensorflow/tools/graph_transforms:transform_graph# bazel-bin/tensorflow/tools/graph_transforms/transform_graph --in_graph="./detection_frozen_model.pb" --out_graph="./detection_transformed_model.pb" --inputs="image,true_image_shape" --outputs="ChangeCoordToOriginalImage/stack,add,TextKeypointPostProcess/Reshape_2,strided_slice_3,BatchMultiClassNonMaxSuppression/stack_8" --transforms='  add_default_attributes   strip_unused_nodes()   remove_nodes(op=Identity, op=CheckNumerics)   fold_constants(ignore_errors=true)   fold_batch_norms   fold_old_batch_norms   quantize_weights'

PS: 模型优化 refer:https://blog.csdn.net/qq_14845119/article/details/78846372 模型量化:https://www.jianshu.com/p/d2637646cda1

tf的log和vlog输出配置

There are two flags, similarly named, but with somewhat different semantics: TF_CPP_MIN_LOG_LEVEL - which has 3 or 4 basic levels - low numbers = more messages.

0 outputs Information, Warning, Error, and Fatals (default) 1 outputs Warning, and above 2 outputs Errors and above. etc... I didn't check edge cases

TF_CPP_MIN_VLOG_LEVEL - which causes very very many extra Information errors - really for debugging only - low numbers = less messages.

3 Outputs lots and lots of stuff 2 Outputs less 1 Outputs even less 0 Outputs nothing extra (default)



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3